#include "ICritvsLengthSave.h"

#include <QString>
#include <QTextStream>
#include <QFile>

ICritvsLengthSave::ICritvsLengthSave()
{

}

ICritvsLengthSave::~ICritvsLengthSave()
{

}

int ICritvsLengthSave::save(Output output,double length,double current)
{
  QFile file(output.getFileName());
  QTextStream data(&file);
  file.open(QIODevice::Append);
  data<<1/length<<"\t";
  data<<length<<"\t";
  data<<current<<endl;
  file.close();
  return 0;
}

int ICritvsLengthSave::initialize(Output output)
{
  QFile file(output.getFileName());
  QTextStream myfile(&file);
  file.open(QIODevice::Append);
  myfile<<"1/t\t";
  myfile<<"t\t";
  myfile<<"Ic"<<endl;
  myfile<<"Hz\t";
  myfile<<"s\t";
  myfile<<"A";
  myfile<<endl;
  file.close();
  return 0;
}
